package com.lch.jvm;

import org.openjdk.jol.info.ClassLayout;

import java.util.StringJoiner;

/**
 * @ClassName Worker
 * @Description
 * @Author liuchenhui
 * @Date 2021/5/9 12:46 下午
 */
public class Worker {

    private Integer i;
    private String name;
    private String address;

    public static void print(Worker worker) {
        System.out.println(ClassLayout.parseInstance(worker).toPrintable());
    }

    public Integer getI() {
        return i;
    }

    public void setI(Integer i) {
        this.i = i;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", Worker.class.getSimpleName() + "[", "]")
                .add("i=" + i)
                .add("name='" + name + "'")
                .add("address='" + address + "'")
                .toString();
    }
}
